home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 23.1 KB | 745 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWFrming.cpp
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWFrameW.hpp"
-
- #ifndef FWFRMING_H
- #include "FWFrming.h"
- #endif
-
- #ifndef FWPARTNG_H
- #include "FWPartng.h"
- #endif
-
- #ifndef FWPXYFRM_H
- #include "FWPxyFrm.h"
- #endif
-
- #ifndef FWPROXY_H
- #include "FWProxy.h"
- #endif
-
- #ifndef FWUTIL_H
- #include "FWUtil.h"
- #endif
-
- #ifndef FWITERS_H
- #include "FWIters.h"
- #endif
-
- #ifndef FWPRESEN_H
- #include "FWPresen.h"
- #endif
-
- #ifndef FWSELECT_H
- #include "FWSelect.h"
- #endif
-
- #ifndef FWTRACKR_H
- #include "FWTrackr.h"
- #endif
-
- #ifndef FWPRTITE_H
- #include "FWPrtIte.h"
- #endif
-
- #ifndef FWFILEOP_H
- #include "FWFileOp.h"
- #endif
-
- #ifndef FWEMBUTL_H
- #include "FWEmbUtl.h"
- #endif
-
- #ifndef FWPXYITE_H
- #include "FWPxyIte.h"
- #endif
-
- #ifndef FWINSCMD_H
- #include "FWInsCmd.h"
- #endif
-
- #ifndef FWSESION_H
- #include "FWSesion.h"
- #endif
-
- // ----- OS Layer -----
-
- #ifndef FWODGEOM_H
- #include "FWODGeom.h"
- #endif
-
- #ifndef FWMNUBAR_H
- #include "FWMnuBar.h"
- #endif
-
- #ifndef FWEVENT_H
- #include "FWEvent.h"
- #endif
-
- #ifndef FWCURSOR_H
- #include "FWCursor.h"
- #endif
-
- #ifndef SLODFSTR_H
- #include "SLODFStr.h"
- #endif
-
- #ifndef SLODFSTR_K
- #include "SLODFStr.k"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_ODArbitrator_xh
- #include <Arbitrat.xh>
- #endif
-
- #ifndef SOM_Module_OpenDoc_Commands_defined
- #include <CmdDefs.xh>
- #endif
-
- #ifndef SOM_ODDispatcher_xh
- #include <Disptch.xh>
- #endif
-
- #ifndef SOM_ODDraft_xh
- #include <Draft.xh>
- #endif
-
- #ifndef SOM_ODFacet_xh
- #include <Facet.xh>
- #endif
-
- #ifndef SOM_ODInfo_xh
- #include <Info.xh>
- #endif
-
- #ifndef SOM_ODSession_xh
- #include <ODSessn.xh>
- #endif
-
- //========================================================================================
- // RunTime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment fw_embedding
- #endif
-
- FW_DEFINE_CLASS_M1(FW_CEmbeddingFrame, FW_CFrame)
- FW_DEFINE_AUTO(FW_CEmbeddingFrame)
-
- //========================================================================================
- // class FW_CEmbeddingFrame
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::FW_CEmbeddingFrame
- //----------------------------------------------------------------------------------------
-
- FW_CEmbeddingFrame::FW_CEmbeddingFrame(Environment* ev,
- ODFrame* odFrame,
- FW_CPresentation* presentation,
- FW_CEmbeddingPart* part) :
- FW_CFrame(ev, odFrame, presentation, part)
- {
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::~FW_CEmbeddingFrame
- //----------------------------------------------------------------------------------------
-
- FW_CEmbeddingFrame::~FW_CEmbeddingFrame()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::EmbeddedFrameRequested
- //----------------------------------------------------------------------------------------
- // Override should return a proxy and a modified suggestedFrameShape
-
- FW_MProxy* FW_CEmbeddingFrame::EmbeddedFrameRequested(Environment *ev,
- FW_MProxy* baseProxy,
- ODFrame* baseFrame,
- ODShape* frameShape,
- ODPart* embeddedPart,
- ODTypeToken viewType,
- ODTypeToken presentation,
- ODID frameGroupID,
- FW_Boolean isOverlaid,
- FW_Boolean isSubFrame)
- {
- FW_UNUSED(ev);
- FW_UNUSED(baseProxy);
- FW_UNUSED(baseFrame);
- FW_UNUSED(frameShape);
- FW_UNUSED(embeddedPart);
- FW_UNUSED(viewType);
- FW_UNUSED(presentation);
- FW_UNUSED(frameGroupID);
- FW_UNUSED(isOverlaid);
- FW_UNUSED(isSubFrame);
-
- return NULL;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::GetProxy
- //----------------------------------------------------------------------------------------
-
- FW_MProxy* FW_CEmbeddingFrame::GetProxy(Environment *ev, ODFrame* embeddedFrame) const
- {
- return ((FW_CEmbeddingPart*)GetPart(ev))->GetProxy(ev, embeddedFrame);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::PrivCreateEmbeddedFrame
- //----------------------------------------------------------------------------------------
-
- FW_DECLARE_THROW_POINT (FW_CEmbeddingFrame_PrivCreateEmbeddedFrame);
-
- ODFrame* FW_CEmbeddingFrame::PrivCreateEmbeddedFrame(Environment* ev,
- ODType frameType,
- ODPart *embeddedODPart,
- ODShape* frameShape,
- ODCanvas* biasCanvas, // can be null
- ODTypeToken viewType,
- ODTypeToken presentationType,
- FW_Boolean isOverlaid,
- FW_Boolean subFrame)
- {
- FW_ASSERT(embeddedODPart);
-
- if (presentationType == 0)
- presentationType = FW_CSession::Tokenize(ev, kODPresDefault);
-
- // ----- Normalize the frameShape -----
- FW_CRect box;
- frameShape->GetBoundingBox(ev, (ODRect*)&box);
- if (box.TopLeft() != FW_kZeroPoint)
- {
- FW_CAcquiredODTransform temp = ::FW_NewODTransform(ev, -box.TopLeft());
- frameShape->Transform(ev, temp);
- }
-
- // ----- create the new frame
- ODFrame* embeddedODFrame = GetPart(ev)->GetDraft(ev)->CreateFrame(ev,
- frameType,
- GetODFrame(ev),
- frameShape,
- biasCanvas,
- embeddedODPart,
- viewType,
- presentationType,
- subFrame,
- isOverlaid);
-
- // Testing: can the caller deal with this method failing?
- FW_CHECK_THROW_POINT (FW_CEmbeddingFrame_PrivCreateEmbeddedFrame);
-
- return embeddedODFrame;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::GetPart
- //----------------------------------------------------------------------------------------
-
- FW_CEmbeddingPart* FW_CEmbeddingFrame::GetPart(Environment *ev) const
- {
- return (FW_CEmbeddingPart*)FW_CFrame::GetPart(ev);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::FrameAdded
- //----------------------------------------------------------------------------------------
-
- void FW_CEmbeddingFrame::FrameAdded(Environment* ev, ODFrame* odFrame, FW_Boolean fromStorage)
- {
- // ----- Call inherited -----
- FW_CFrame::FrameAdded(ev, odFrame, fromStorage);
-
- if (!fromStorage)
- {
- // Set the containing frame of any orphan embedded frames
- FW_CPartProxyFrameIterator ite(GetPart(ev));
- for (FW_CProxyFrame* proxyFrame = ite.First(); ite.IsNotComplete(); proxyFrame = ite.Next())
- {
- if (proxyFrame->IsOrphan(ev))
- proxyFrame->SetContainingFrame(ev, this);
- }
- }
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::PrivAttachSourceFrame
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::AttachSourceFrame should not be called if sourceFrame == NULL
-
- void FW_CEmbeddingFrame::PrivAttachSourceFrame(Environment* ev, FW_CFrame* sourceFrame)
- {
- // Call inherited first to set the fSourceFrame field
- FW_CFrame::PrivAttachSourceFrame(ev, sourceFrame);
-
- FW_ASSERT(sourceFrame != NULL);
-
- // ----- If I am an embedding frame, sourceFrame must be too
- FW_CEmbeddingFrame* embeddingSourceFrame = FW_DYNAMIC_CAST(FW_CEmbeddingFrame, sourceFrame);
- FW_ASSERT(embeddingSourceFrame);
-
- // ----- Duplicate all the embedded frames of sourceFrame -----
- // ----- PrivCreateEmbeddedFrame doesn't create facets, wait for FacetAdded to duplicate my facets -----
- FW_CFrameProxyFrameIterator iter(ev, embeddingSourceFrame);
- for (FW_CProxyFrame* proxyFrame = iter.First(ev); iter.IsNotComplete(ev); proxyFrame = iter.Next(ev))
- {
- FW_Boolean wasInMemory = proxyFrame->IsFrameInMemory(ev);
-
- // ----- get the embedded frame -----
- ODFrame* odEmbeddedSourceFrame = proxyFrame->GetFrame(ev);
-
- // ----- get the embedded part -----
- FW_CAcquiredODPart aqODEmbeddedPart = odEmbeddedSourceFrame->AcquirePart(ev);
-
- // ----- Create the embedded Frame (proxyFrame) -----
- FW_CAcquiredODShape aqFrameShapeCopy(FW_CopyAndRelease(ev, odEmbeddedSourceFrame->AcquireFrameShape(ev, NULL)));
-
- FW_CAcquiredODFrame embeddedODFrame = PrivCreateEmbeddedFrame(ev,
- kODFrameObject, // Always create embedded frames persistent
- // IsPersistent(ev) ? kODFrameObject : kODNonPersistentFrameObject,
- aqODEmbeddedPart,
- aqFrameShapeCopy,
- NULL, // bias Canvas
- odEmbeddedSourceFrame->GetViewType(ev),
- odEmbeddedSourceFrame->GetPresentation(ev),
- odEmbeddedSourceFrame->IsOverlaid(ev),
- odEmbeddedSourceFrame->IsSubframe(ev));
-
- // ----- Create the proxyFrame -----
- FW_CProxyFrame* newProxyFrame = proxyFrame->GetProxy(ev)->PrivNewProxyFrame(ev, GetPart(ev), this, embeddedODFrame, FALSE);
-
- // ----- Set the frame group
- newProxyFrame->PrivSetFrameGroup(ev, odEmbeddedSourceFrame->GetFrameGroup(ev));
-
- // ----- Notify the Embedded frame-----
- aqODEmbeddedPart->AttachSourceFrame(ev, newProxyFrame->GetFrame(ev), odEmbeddedSourceFrame);
-
- // ----- If was not in memory Release back the embedded frame -----
- if (!wasInMemory)
- proxyFrame->Release(ev);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::PrivRemoveEmbeddedFrame
- //----------------------------------------------------------------------------------------
-
- void FW_CEmbeddingFrame::PrivRemoveEmbeddedFrame(Environment* ev, FW_CProxyFrame* proxyFrame)
- {
- // If called means that the embedded frame is in memory
- // Be sure it is in memory
- ODFrame* odEmbeddedFrame = proxyFrame->GetFrame(ev);
-
- // ----- Detach the proxyframe -----
- proxyFrame->PrivDetach(ev);
-
- // ----- remove it from the proxy (will delete it) -----
- proxyFrame->GetProxy(ev)->PrivDeleteProxyFrame(ev, proxyFrame);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::FrameRemoved
- //----------------------------------------------------------------------------------------
- // I should not have to worry about my embedded facets because before the frame is removed
- // its facets should have been removed, removing the embedded facets
-
- void FW_CEmbeddingFrame::FrameRemoved(Environment* ev, FW_Boolean toStorage)
- {
- // ----- Collect the proxyFrames in a temporary collections -----
- FW_TOrderedCollection<FW_CProxyFrame> tempCollect;
- FW_CProxyFrame* proxyFrame;
-
- FW_CFrameProxyFrameIterator ite1(ev, this);
- for (proxyFrame = ite1.First(ev); ite1.IsNotComplete(ev); proxyFrame = ite1.Next(ev))
- {
- tempCollect.AddLast(proxyFrame);
- }
-
- // ----- Now we can call close or remove
- FW_TOrderedCollectionIterator<FW_CProxyFrame> ite2(&tempCollect);
- for (proxyFrame = ite2.First(); ite2.IsNotComplete(); proxyFrame = ite2.Next())
- {
- if (toStorage)
- proxyFrame->PrivClose(ev);
- else
- this->PrivRemoveEmbeddedFrame(ev, proxyFrame);
- }
-
- // Don't have to call tempCollect.RemoveAll() because the __dt does it
-
- // ----- Call inherited -----
- FW_CFrame::FrameRemoved(ev, toStorage);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::FacetAdded
- //----------------------------------------------------------------------------------------
- // When overridden call inherited::FacetAdded FIRST
-
- void FW_CEmbeddingFrame::FacetAdded(Environment* ev, ODFacet* facet, unsigned short facetCount)
- {
- // ----- Call inherited first
- FW_CFrame::FacetAdded(ev, facet, facetCount);
-
- // ----- Add facets to each one of my embedded frame (that are in memory) -----
- if (GetViewType(ev) == FW_CPart::fgViewAsFrameToken)
- {
- FW_CFrameProxyFrameIterator ite(ev, this);
- for (FW_CProxyFrame* proxyFrame = ite.First(ev); ite.IsNotComplete(ev); proxyFrame = ite.Next(ev))
- {
- proxyFrame->CreateFacets(ev, this, facet);
- }
- }
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::FacetRemoved
- //----------------------------------------------------------------------------------------
- // When overridden call inherited::FacetRemoved LAST
-
- void FW_CEmbeddingFrame::FacetRemoved(Environment* ev, ODFacet* facet, unsigned short facetCount)
- {
- // ----- Remove Embedded Facets
- FW_CFrameProxyFrameIterator ite(ev, this);
- for (FW_CProxyFrame* proxyFrame = ite.First(ev); ite.IsNotComplete(ev); proxyFrame = ite.Next(ev))
- proxyFrame->RemoveFacets(ev, this, facet);
-
- // ----- Call inherited
- FW_CFrame::FacetRemoved(ev, facet, facetCount);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::HasASelectedEmbeddedFacet
- //----------------------------------------------------------------------------------------
-
- FW_Boolean FW_CEmbeddingFrame::HasASelectedEmbeddedFacet(Environment* ev) const
- {
- FW_CFrameProxyFrameIterator iter(ev, this);
- for (FW_CProxyFrame* proxyFrame = iter.First(ev); iter.IsNotComplete(ev); proxyFrame = iter.Next(ev))
- {
- if (proxyFrame->GetProxy(ev)->GetSelectState(ev))
- return TRUE;
- }
-
- return FALSE;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::HandleAdjustMenus
- //----------------------------------------------------------------------------------------
-
- FW_Handled FW_CEmbeddingFrame::HandleAdjustMenus(Environment* ev, FW_CMenuBar* menuBar,
- FW_Boolean hasMenuFocus, FW_Boolean isRoot)
- {
- PrivSetInfoCommandAdjusted(ev, false);
-
- if (hasMenuFocus)
- {
- FW_CString infoString;
- FW_Boolean hasSelectedEmbeddedFacets = false;
-
- //--- Check for Link Info and Selection Info ---
- FW_Boolean gotInfo = PrivGetInfoString(ev, GetPresentation(ev)->GetSelection(ev), infoString);
- if (!gotInfo || infoString.IsEmpty())
- {
- hasSelectedEmbeddedFacets = HasASelectedEmbeddedFacet(ev);
-
- //--- Adjust the Show Part Info item ---
- if (hasSelectedEmbeddedFacets)
- {
- ::FW_PrivLoadODFString(ev, FW_kPartInfoString, infoString);
- menuBar->SetItemString(ev, kODCommandGetPartInfo, infoString);
- PrivSetInfoCommandAdjusted(ev, true); // so that FW_CFrame::HandleAdjustMenus doesn't change it
- gotInfo = true;
- }
- }
- else
- {
- menuBar->SetItemString(ev, kODCommandGetPartInfo, infoString);
- PrivSetInfoCommandAdjusted(ev, true); // so that FW_CFrame::HandleAdjustMenus doesn't go thru the whole thing again
- }
- menuBar->EnableCommand(ev, kODCommandGetPartInfo, gotInfo);
-
- menuBar->EnableCommand(ev, kODCommandOpen, hasSelectedEmbeddedFacets);
- menuBar->EnableCommand(ev, kODCommandInsert, !GetPart(ev)->IsReadOnly(ev));
-
- #ifdef FW_BUILD_WIN
- GetPart(ev)->WinEnableEmbedMenu(ev, menuBar);
- #endif
- }
-
- return FW_CFrame::HandleAdjustMenus(ev, menuBar, hasMenuFocus, isRoot);
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::HandleMenu
- //----------------------------------------------------------------------------------------
-
- FW_Handled FW_CEmbeddingFrame::HandleMenu(Environment* ev, const FW_CMenuEvent& theMenuEvent)
- {
- FW_Handled result = FW_kHandled;
- ODCommandID commandID = theMenuEvent.GetCommandID(ev);
-
- #ifdef FW_BUILD_WIN
- ODPart *embeddedPart = GetPart(ev)->WinCreateEmbeddedPartFromCommand(ev, commandID);
- if (embeddedPart != NULL)
- {
- this->EmbedSingleFrame(ev, embeddedPart, NULL, NULL, GetPresentation(ev)->GetDefaultEmbeddedFrameViewType(ev));
- return FW_kHandled;
- }
- #endif
-
- FW_CSelection* selection = this->GetPresentation(ev)->GetSelection(ev);
- switch (commandID)
- {
- case kODCommandInsert:
- {
- FW_ASSERT(!GetPart(ev)->IsReadOnly(ev));
-
- #ifdef FW_BUILD_WIN
- FW_COpenFileParameters openFileParameters; // Uses default open file parameters
- DoInsert(ev, openFileParameters);
- #endif
- #ifdef FW_BUILD_MAC
- FW_COpenFileParameters openFileParameters(&FW_MacInsertFilterProc); // Allows only odtm documents
- DoInsert(ev, openFileParameters);
- #endif
- }
- break;
-
- case kODCommandGetPartInfo:
- ShowPartInfo(ev);
- break;
-
- case kODCommandOpen:
- OpenSelection(ev);
- break;
-
- default:
- result = FW_CFrame::HandleMenu(ev, theMenuEvent);
- };
-
- return result;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::NewInsertCommand
- //----------------------------------------------------------------------------------------
-
- FW_CInsertCommand* FW_CEmbeddingFrame::NewInsertCommand(Environment* ev, const FW_PFileSpecification& fileSpec)
- {
- FW_UNUSED(ev);
- FW_UNUSED(fileSpec);
-
- FW_DEBUG_MESSAGE("NewInsertCommand: subclass responsability");
- return NULL;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::DoInsert
- //----------------------------------------------------------------------------------------
-
- void FW_CEmbeddingFrame::DoInsert(Environment* ev, FW_COpenFileParameters& openFileParameters)
- {
- FW_PFileSpecification fileSpec(ev, FW_CChooseFile::ChooseFileToOpen(openFileParameters));
-
- if (fileSpec != NULL)
- {
- FW_CInsertCommand* cmd = this->NewInsertCommand(ev, fileSpec);
- if (cmd)
- cmd->Execute(ev);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::OpenSelection
- //----------------------------------------------------------------------------------------
-
- void FW_CEmbeddingFrame::OpenSelection(Environment* ev)
- {
- // I need to collect first the proxyframe that I want to open because opening the first
- // window will unselect the other one
-
- FW_CProxyFrame* proxyFrame;
-
- FW_TOrderedCollection<FW_CProxyFrame> temp;
-
- FW_CFrameProxyFrameIterator iter(ev, this);
- for (proxyFrame = iter.First(ev); iter.IsNotComplete(ev); proxyFrame = iter.Next(ev))
- {
- if (proxyFrame->GetProxy(ev)->GetSelectState(ev))
- temp.AddLast(proxyFrame);
- }
-
- FW_TOrderedCollectionIterator<FW_CProxyFrame> iter2(&temp);
- for (proxyFrame = iter2.First(); iter2.IsNotComplete(); proxyFrame = iter2.Next())
- {
- proxyFrame->GetProxy(ev)->OpenInWindow(ev, proxyFrame);
- }
-
- // the destructor of temp will call RemoveAll
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::ShowPartInfo
- //----------------------------------------------------------------------------------------
-
- FW_Handled FW_CEmbeddingFrame::ShowPartInfo(Environment* ev)
- {
- FW_Boolean handledIt = FW_CFrame::ShowPartInfo(ev);
- if (handledIt)
- return handledIt;
-
- FW_CFrameProxyFrameIterator iter(ev, this);
- for (FW_CProxyFrame* proxyFrame = iter.First(ev); iter.IsNotComplete(ev); proxyFrame = iter.Next(ev))
- {
- FW_MProxy *proxy = proxyFrame->GetProxy(ev);
- FW_ASSERT(proxy);
-
- if (proxy->GetSelectState(ev))
- {
- // ----- Try first the active facet -----
- ODFacet* facet = this->GetActiveFacet(ev);
-
- // ----- If not Active facet try the first facet -----
- if (facet == NULL)
- {
- FW_CFrameFacetIterator iteFrame(ev, this);
- facet = iteFrame.First(ev);
- }
- FW_ASSERT(facet != NULL);
-
- // [HLX] We are passing the first facet but we need to be a little bit more smart
- // about that. We should pass the selected one or if there is no selection do it on ourself
- FW_CEmbeddedODFacetsIterator ite(ev, proxy, facet, kODFrontToBack);
- ODFacet* firstEmbeddedFacet = ite.First(ev);
- FW_ASSERT(firstEmbeddedFacet != NULL);
-
- ODFrame* embeddedFrame = proxyFrame->GetFrame(ev);
- ODTypeToken oldViewType = embeddedFrame->GetViewType(ev);
-
- FW_CSession::GetInfo(ev)->ShowPartFrameInfo(ev, firstEmbeddedFacet, !GetPart(ev)->IsReadOnly(ev));
-
- ODTypeToken newViewType = embeddedFrame->GetViewType(ev);
-
- // ----- Propagate the view type to other sibling frames -----
- if (oldViewType != newViewType)
- {
- FW_CProxyEmbeddedFrameIterator iter2(ev, proxy);
- for (ODFrame* sibling = iter2.First(ev); iter2.IsNotComplete(ev); sibling = iter2.Next(ev))
- {
- sibling->ChangeViewType(ev, newViewType);
- }
- }
- handledIt = FW_kHandled;
- }
- }
-
- return handledIt;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::ViewTypeChanged
- //----------------------------------------------------------------------------------------
-
- void FW_CEmbeddingFrame::ViewTypeChanged(Environment* ev, ODTypeToken newViewType, ODTypeToken oldViewType)
- {
- FW_CFrame::ViewTypeChanged(ev, newViewType, oldViewType);
-
- FW_CFrameProxyFrameIterator ite(ev, this);
- for (FW_CProxyFrame* proxyframe = ite.First(ev); ite.IsNotComplete(ev); proxyframe = ite.Next(ev))
- {
- if (oldViewType == FW_CPart::fgViewAsFrameToken)
- proxyframe->RemoveAllFacets(ev);
- else
- proxyframe->CreateAllFacets(ev);
- }
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::AdjustCursor
- //----------------------------------------------------------------------------------------
-
- FW_Handled FW_CEmbeddingFrame::AdjustCursor(Environment *ev, ODFacet* odFacet, const FW_CPoint& theMousePoint, ODEventInfo* eventInfo)
- {
- FW_UNUSED(eventInfo);
-
- // ----- Test if mouse on the active border of an embedded facet -----
- FW_Handled handled = FW_kNotHandled;
-
- ODArbitrator* arbitrator = FW_CSession::GetArbitrator(ev);
- FW_CAcquiredODFrame aqActiveFrame = arbitrator->AcquireFocusOwner(ev, FW_CPart::fgSelectionFocusToken);
- if (aqActiveFrame != NULL)
- {
- FW_CODFrameFacetIterator iter(ev, aqActiveFrame);
-
- FW_CPoint windowMouse(theMousePoint);
- FW_FrameToWindow(ev, odFacet, windowMouse);
-
- for (ODFacet* facet = iter.First(ev); iter.IsNotComplete(ev); facet = iter.Next(ev))
- {
- FW_CPoint temp(windowMouse);
- FW_WindowToFrame(ev, facet, temp);
- ODPoint odFramePoint = temp;
-
- if (facet->ActiveBorderContainsPoint(ev, &odFramePoint, NULL))
- {
- handled = FW_kHandled;
- break;
- }
- }
- }
-
- if (handled)
- FW_gOpenHandCursor.Select();
-
- return handled;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::ODtoFWEmbeddingFrame
- //----------------------------------------------------------------------------------------
-
- FW_CEmbeddingFrame* FW_CEmbeddingFrame::ODtoFWEmbeddingFrame(Environment* ev, ODFrame* odFrame)
- {
- FW_CEmbeddingFrame* frame = NULL;
-
- if (odFrame)
- {
- FW_CFrame* fwframe = (FW_CFrame*)odFrame->GetPartInfo(ev);
- frame = fwframe ? FW_DYNAMIC_CAST(FW_CEmbeddingFrame, fwframe) : NULL;
- }
-
- return frame;
- }
-
- //---------------------------------------------------------------------------------------
- // FW_CEmbeddingFrame::PrivStartStopDragging
- //---------------------------------------------------------------------------------------
- // call from FW_CDragCommand::BeginDrag
-
- void FW_CEmbeddingFrame::PrivStartStopDragging(Environment *ev, FW_EPrivDraggingFlags dragFlags)
- {
- FW_CFrameProxyFrameIterator ite(ev, this);
- for (FW_CProxyFrame* proxyFrame = ite.First(ev); ite.IsNotComplete(ev); proxyFrame = ite.Next(ev))
- {
- // FW_CProxyFrame is doing the right check before setting the embedded ODFrame
- proxyFrame->PrivSetDragging(ev, dragFlags);
- }
- }
-